package com.lz.yz.base.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Administrator on 2017/2/20 0020.
 */
public class DateHelper {
    private static final String default_ymdhms = "yyyy-MM-dd HH:mm:ss";
    private static final String ymd = "yyyy-MM-dd";
    private static final String ymdhms = "yyyyMMddHHmmss";
    private static final String yyMMddHHmmss = "yyMMddHHmmss";
    private static final String HHmmss = "HHmmss";
    private static final String ymdhm = "yyyy年MM月dd日 HH:mm";

    public DateHelper() {
    }

    public static String format(Date date) {
        return (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
    }

    public static Date formatDate(String time) {
        Date date = null;

        try {
            date = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).parse(time);
        } catch (Exception var3) {
            ;
        }

        return date;
    }

    public static String formatYMD(Date date) {
        return (new SimpleDateFormat("yyyy-MM-dd")).format(date);
    }

    public static Date puaseDateYMD(String time) {
        Date date = null;

        try {
            date = (new SimpleDateFormat("yyyy-MM-dd")).parse(time);
        } catch (Exception var3) {
            ;
        }

        return date;
    }

    public static String formatYMDHMS(Date date) {
        return (new SimpleDateFormat("yyyyMMddHHmmss")).format(date);
    }

    public static Date parseDateYMDHMS(String time) {
        Date date = null;

        try {
            date = (new SimpleDateFormat("yyyyMMddHHmmss")).parse(time);
        } catch (Exception var3) {
            ;
        }

        return date;
    }

    public static String formatyyMDHMS(Date date) {
        return (new SimpleDateFormat("yyMMddHHmmss")).format(date);
    }

    public static Date parseDateyyMDHMS(String time) {
        Date date = null;

        try {
            date = (new SimpleDateFormat("yyMMddHHmmss")).parse(time);
        } catch (Exception var3) {
            ;
        }

        return date;
    }

    public static String formatHHmmss(Date date) {
        return (new SimpleDateFormat("HHmmss")).format(date);
    }

    public static Date parseDateHHmmss(String time) {
        Date date = null;

        try {
            date = (new SimpleDateFormat("HHmmss")).parse(time);
        } catch (ParseException var3) {
            var3.printStackTrace();
        }

        return date;
    }

    public static String formatYmdhm(Date date) {
        return (new SimpleDateFormat(ymdhm)).format(date);
    }

    public static Date parseDateYmdhm(String time) {
        Date date = null;

        try {
            date = (new SimpleDateFormat(ymdhm)).parse(time);
        } catch (ParseException var3) {
            var3.printStackTrace();
        }

        return date;
    }
}